package com.pm.controller.dept;

import com.pm.common.Response;
import com.pm.common.annotation.UserLoginToken;
import com.pm.common.exception.ExpCodeState;
import com.pm.entity.po.dept.DeptType;
import com.pm.service.dept.DeptTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "部门类型管理")
@UserLoginToken
@RestController
@RequestMapping("/deptType")
public class DeptTypeController {

    @Autowired
    private DeptTypeService deptTypeService;

    @ApiOperation("查询所有部门类型id和名称")
    @PostMapping("/getAllDeptType")
    @ResponseBody
    public Response<List<DeptType>> getAllDeptName() {
        List<DeptType> result = deptTypeService.getAllDeptType();
        Response<List<DeptType>> res = new Response<>(ExpCodeState.query_data_success, result);
        return res;
    }

    @ApiOperation("查询不包括零时工作组的部门类型id和名称")
    @PostMapping("/getDeptTypeNotFive")
    @ResponseBody
    public Response<List<DeptType>> getAllDeptTypeNotFive() {
        List<DeptType> result = deptTypeService.getDeptTypeNotFive();
        Response<List<DeptType>> res = new Response<>(ExpCodeState.query_data_success, result);
        return res;
    }
}
